package com.encryptdemo.demos.web;

import cn.hutool.core.util.ObjectUtil;
import cn.hutool.extra.ssh.JschUtil;
import com.encryptdemo.encrypt2.annotation.Decrypt;
import com.encryptdemo.encrypt2.annotation.Encrypt;
import com.encryptdemo.encrypt2.domain.R;
import com.encryptdemo.encrypt2.util.JsonUtils;
import com.encryptdemo.encrypt3.annotation.EncDec;
import com.encryptdemo.encrypt3.domain.ResponseResult;
import org.springframework.http.MediaType;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/encrypt")
public class TestController {


    @EncDec
    @GetMapping("/encrypt")
    public ResponseResult encryptTest(){
        User user = new User();
        user.setName("walker");
        user.setAge(18);

        return ResponseResult.success("请求成功",user);
    }



    /**
     * 解密测试
     */
    @EncDec(resultEnc = false)
    @PostMapping("/decrypt")
    public ResponseResult decrypt(@RequestBody User user){
        System.out.println("解密后数据======" + user);
        return ResponseResult.success("成功",user);
    }
}

